package com.katze.common.http;

import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;

public interface WebClientService {

    <T>T getHttpServiceProxyFactory(String id, Class<T> c);

    default HttpServiceProxyFactory createHttpServiceProxyFactory(String uri) {
        WebClient client = WebClient.builder().baseUrl(uri).build();
        return HttpServiceProxyFactory.builderFor(WebClientAdapter.create(client)).build();
    }
}
